// File:       poscmd08.c++
// Version:    1.00
// Author:     (c) Miles Sabin, 1997
// Purpose:    seekpos command

// Change log:
//  29/03/97   v. 1.00

#include "poscmds.h"

#include "ostream.h"
#include "streambuf.h"


// Implementation of OStreamSeekposCommand

OStreamSeekposCommand::OStreamSeekposCommand(basic_ostream_char& os, int sp, ios::openmode which)
  : sp_(sp),
    which_(which)
  { execute_template(os); }

OStreamSeekposCommand::~OStreamSeekposCommand()
  {}

ios::iostate OStreamSeekposCommand::execute(basic_ostream_char& os)
  {
    result_ = os.rdbuf()->pubseekpos(sp_, which_);
    return ios::goodbit;
  }


// Implementation of basic_ostream_char

basic_ostream_char& basic_ostream_char::seekp(int pos)
  {
    if(!fail())
    {
      OStreamSeekposCommand cmd(*this, pos);
    }
    return *this;
  }

